package ink.lovejinhu.leetcode;

/**
 * @author jinhu
 * created 2021-08-05 15:50
 */
public class Solution_0746 {
    public int minCostClimbingStairs(int[] cost) {
        int[] fi = new int[cost.length + 1];
        fi[0] = 0;
        fi[1] = 0;

        for (int i = 2; i <= cost.length; i++) {
            fi[i] = Math.min(fi[i - 1] + cost[i - 1], fi[i - 2] + cost[i - 2]);
        }
        return fi[fi.length - 1];
    }
}
